#! /usr/bin/env python
# coding:utf-8
'''
本模块是为了实现删除学生成绩
'''
def del_grade():
    from function import cat_grade, db, cursor
    try:
        while True:
            stu_num = input('请输入你要删除成绩的学号：')
            if_id = 'DELETE FROM studata WHERE id=%d' % stu_num
            if cursor.execute(if_id):
                db.commit()
                print '修改成功，修改后的成绩表为：'
                cat_grade()
            else:
                print '请输入正确的学号！！'
            select = input('继续请按1，返回请按0：')
            if select == 0:
                 break
    except (TypeError,EOFError, NameError,IOError, SyntaxError, ValueError):
        print '输入错误，请重新输入！！'